﻿CREATE Proc [dbo].[proc_Wage_TiCheng_Person]
(
	@Consignee nvarchar(50),
	@FaFangMonth nvarchar(50),
	@TypeId int
)	
as
Begin
	Select
	ProductId,
	ProductName,
	Count(Id) As Num,
	Sum(SalePrice) As SalePrice,
	Sum(CostPrice) As CostPrice
	From Project
	Where TypeId=@TypeId and OrderId in(Select OId From Employee_Wage_TiCheng Where Consignee=@Consignee and FaFangMonth=@FaFangMonth)
	Group by ProductId,ProductName

End